package com.snpic.appaw.module.insure.dal.mysql.vehicleregistration;

import java.util.*;

import com.snpic.appaw.framework.common.pojo.PageResult;
import com.snpic.appaw.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.snpic.appaw.framework.mybatis.core.mapper.BaseMapperX;
import com.snpic.appaw.module.insure.dal.dataobject.vehicleregistration.VehicleRegistrationDO;
import org.apache.ibatis.annotations.Mapper;
import com.snpic.appaw.module.insure.controller.app.vehicleregistration.vo.*;

/**
 * 车辆登记 Mapper
 *
 * @author jijun
 */
@Mapper
public interface VehicleRegistrationMapper extends BaseMapperX<VehicleRegistrationDO> {

    default PageResult<VehicleRegistrationDO> selectPage(AppVehicleRegistrationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VehicleRegistrationDO>()
                .eqIfPresent(VehicleRegistrationDO::getTaskNumber, reqVO.getTaskNumber())
                .likeIfPresent(VehicleRegistrationDO::getName, reqVO.getName())
                .eqIfPresent(VehicleRegistrationDO::getPhone, reqVO.getPhone())
                .eqIfPresent(VehicleRegistrationDO::getIdNo, reqVO.getIdNo())
                .eqIfPresent(VehicleRegistrationDO::getSeatNum, reqVO.getSeatNum())
                .likeIfPresent(VehicleRegistrationDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(VehicleRegistrationDO::getVin, reqVO.getVin())
                .eqIfPresent(VehicleRegistrationDO::getEngineNumber, reqVO.getEngineNumber())
                .betweenIfPresent(VehicleRegistrationDO::getDebutDate, reqVO.getDebutDate())
                .eqIfPresent(VehicleRegistrationDO::getLocations, reqVO.getLocations())
                .eqIfPresent(VehicleRegistrationDO::getLicensePlateNumber, reqVO.getLicensePlateNumber())
                .eqIfPresent(VehicleRegistrationDO::getInsurancePlan, reqVO.getInsurancePlan())
                .likeIfPresent(VehicleRegistrationDO::getBrandName, reqVO.getBrandName())
                .eqIfPresent(VehicleRegistrationDO::getImageUrl, reqVO.getImageUrl())
                .betweenIfPresent(VehicleRegistrationDO::getSubmissionTime, reqVO.getSubmissionTime())
                .betweenIfPresent(VehicleRegistrationDO::getDrawTime, reqVO.getDrawTime())
                .eqIfPresent(VehicleRegistrationDO::getTaskStatus, reqVO.getTaskStatus())
                .eqIfPresent(VehicleRegistrationDO::getReceiver, reqVO.getReceiver())
                .betweenIfPresent(VehicleRegistrationDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(VehicleRegistrationDO::getRemark, reqVO.getRemark())
                .likeIfPresent(VehicleRegistrationDO::getCarOwnerName, reqVO.getCarOwnerName())
                .eqIfPresent(VehicleRegistrationDO::getCarOwnerIdno, reqVO.getCarOwnerIdno())
                .eqIfPresent(VehicleRegistrationDO::getCarOwnerPhoneNo, reqVO.getCarOwnerPhoneNo())
                .likeIfPresent(VehicleRegistrationDO::getInsuredName, reqVO.getInsuredName())
                .eqIfPresent(VehicleRegistrationDO::getInsuredIdno, reqVO.getInsuredIdno())
                .eqIfPresent(VehicleRegistrationDO::getInsuredPhoneNo, reqVO.getInsuredPhoneNo())
                .eqIfPresent(VehicleRegistrationDO::getCompanyLevel, reqVO.getCompanyLevel())
                .eqIfPresent(VehicleRegistrationDO::getRelation, reqVO.getRelation())
                .eqIfPresent(VehicleRegistrationDO::getPost, reqVO.getPost())
                .eqIfPresent(VehicleRegistrationDO::getChannel, reqVO.getChannel())
                .eqIfPresent(VehicleRegistrationDO::getBranchOn, reqVO.getBranchOn())
                .eqIfPresent(VehicleRegistrationDO::getOldId, reqVO.getOldId())
                .orderByDesc(VehicleRegistrationDO::getId));
    }

}